#include <iostream> 
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <fstream>
using namespace std;

#include "bgacomlib.h"
#include <crtdbg.h>
#include <tchar.h>
//#include "../../../../sqa/serial/serial/serial.h"
using namespace BogozmaCommunicationLibrary;


// Declaration of all boolean variables

// Done
bool testOpenDevice0;
bool testOpenDevice1;
bool testOpenDevice2;
bool testOpenDevice3;
bool testOpenDevice4;
bool testOpenDevice5;
bool testOpenDevice6;
bool testOpenDevice7;
bool testOpenDevice8 = true;

// Done
bool testSetGetDeviceInfo0;
bool testSetGetDeviceInfo1;
bool testSetGetDeviceInfo2 = true;

// Done
bool testSetGetIpAddress0;
bool testSetGetIpAddress1;
bool testSetGetIpAddress2;
bool testSetGetIpAddress3 = true;

// Done
bool testSetGetGateway0;
bool testSetGetGateway1;
bool testSetGetGateway2 = true;

// Done
bool testSetGetSubnetMask0;
bool testSetGetSubnetMask1;
bool testSetGetSubnetMask2 = true;

// Done
bool testSetGetPrimaryDns0;
bool testSetGetPrimaryDns1;
bool testSetGetPrimaryDns2 = true;

// Done
bool testSetGetSecondaryDns0;
bool testSetGetSecondaryDns1;
bool testSetGetSecondaryDns2 = true;

// Done
bool testSetGetName0;
bool testSetGetName1;
bool testSetGetName2 = true;

// Not Done
bool testGetHardwareRevision0;
bool testGetHardwareRevision1 = true;

// Not Done
bool testGetFirmwareRevision0;
bool testGetFirmwareRevision1 = true;

// Done
bool testGetType0;
bool testGetType1;
bool testGetType2 = true;

// Not Done
bool testGetMacAddress0;
bool testGetMacAddress1 = true;

// Done
bool testSetGetBaudRate0;
bool testSetGetBaudRate1;
bool testSetGetBaudRate2;
bool testSetGetBaudRate3;
bool testSetGetBaudRate4;
bool testSetGetBaudRate5;
bool testSetGetBaudRate6;
bool testSetGetBaudRate7;
bool testSetGetBaudRate8;
bool testSetGetBaudRate9;
bool testSetGetBaudRate10;
bool testSetGetBaudRate11 = true;

// Done
bool testSetGetParity0;
bool testSetGetParity1;
bool testSetGetParity2;
bool testSetGetParity3;
bool testSetGetParity4 = true;

// Done
bool testSetGetDataBits0;
bool testSetGetDataBits1;
bool testSetGetDataBits2;
bool testSetGetDataBits3 = true;

// Done
bool testSetGetFlowControl0;
bool testSetGetFlowControl1;
bool testSetGetFlowControl2;
bool testSetGetFlowControl3;
bool testSetGetFlowControl4 = true;

// Done
bool testUdpRegRead0;
bool testUdpRegRead1;
bool testUdpRegRead2;
bool testUdpRegRead3;
bool testUdpRegRead4;
bool testUdpRegRead5 = true;

// Done
bool testReadWriteData0;
bool testReadWriteData1;
bool testReadWriteData2;
bool testReadWriteData3 = true;

// Done
bool testSaveConfiguration0;
bool testSaveConfiguration1;
bool testSaveConfiguration2 = true;

// Done
bool testIsAvailable0;
bool testIsAvailable1;
bool testIsAvailable2 = true;

CBgaNetSystem* my_system;
CBgaLinkoo* my_linkoo;


///////////////////////////////////////////////////////////
////////////////////// SET UP /////////////////////////////
///////////////////////////////////////////////////////////

void setUp()
{
	my_system = NULL;
	my_linkoo = NULL;

	my_system = new CBgaNetSystem(eAny);

	//To perform the test we always select the first Device found on the network.
	my_linkoo = (CBgaLinkoo*)my_system->GetDevice(0);
}

///////////////////////////////////////////////////////////
////////////////////// SET UP /////////////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////////// TEAR DOWN ///////////////////////////
///////////////////////////////////////////////////////////

void tearDown()
{  
	if(my_system != NULL)
    {
		delete my_system;
		my_system = NULL;
    }

	my_linkoo = NULL;
}

///////////////////////////////////////////////////////////
///////////////////// TEAR DOWN ///////////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
////////////////// TEST OPEN DEVICE ///////////////////////
///////////////////////////////////////////////////////////
/*
void testOpenDevice()
{
	if(my_linkoo != NULL)
	{
		testOpenDevice0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testOpenDevice0 = false;
	}
	
	//this will "hog" device 0
	try
    {
		if(my_linkoo->GetNetworkInfo()->IsPasswordProtected() == false)
		{
			testOpenDevice1 = true;
		}
		else
		{
			testOpenDevice1 = false;
		}

		my_linkoo->OpenDevice();

		//Next call to OpenDevice() is supposed to fail since it's already connected
		try
        {
			my_linkoo->OpenDevice();
        }
		
		catch(CBgaException e)
        {
			if(e.GetExceptionId() == EX_NO_CONNECT_ID)
			{
				testOpenDevice2 = true;
			}
			else
			{
				testOpenDevice2 = false;
			}
        }

		//program a password for use in the device
		my_linkoo->GetNetworkInfo()->SetPassword("ValidPassword");

		if(my_linkoo->GetNetworkInfo()->IsPasswordProtected() == true)
		{
			testOpenDevice3 = true;
		}
		else
		{
			testOpenDevice3 = false;
		}

		//logoff now since we want to connect with a password for now.
		my_linkoo->CloseDevice();

		//Check again when we are not actually logged on....
		if(my_linkoo->GetNetworkInfo()->IsPasswordProtected() == true)
		{
			testOpenDevice4 = true;
		}
		else
		{
			testOpenDevice4 = false;
		}

		if(my_linkoo->GetNetworkInfo()->IsPasswordProtected())
        {
			//Next call to OpenDevice() id supposed to fail since we are using an invalid password
			try
			{
				my_linkoo->OpenDevice("InvalidPassword");
            }
			
			catch(CBgaException e)
            {
				if(e.GetExceptionId() == EX_BAD_PASSWORD_ID)
				{
					testOpenDevice5 = true;
				}
				else
				{
					testOpenDevice5 = false;
				}
            }
        }      

		//Testing with a valid password
		my_linkoo->OpenDevice("ValidPassword");

		//Next call to OpenDevice() is supposed to fail since it's already connected
		try
        {
			my_linkoo->OpenDevice();
        }
      
		catch(CBgaException e)
        {
			if(e.GetExceptionId() == EX_NO_CONNECT_ID)
			{
				testOpenDevice6 = true;
			}
			else
			{
				testOpenDevice6 = false;
			}
        }

		//before we log off completely, let's clear the password.
		my_linkoo->GetNetworkInfo()->SetPassword(NULL);

		if(my_linkoo->GetNetworkInfo()->IsPasswordProtected() == false)
		{
			testOpenDevice7 = true;
		}
		else
		{
			testOpenDevice7 = false;
		}

		//logoff
		my_linkoo->CloseDevice();
	}
   
	catch(CBgaException &e)
    {
		if(my_linkoo && my_linkoo->GetNetworkInfo()->IsPasswordProtected() && my_linkoo->IsOpen())
        {
			my_linkoo->GetNetworkInfo()->SetPassword(NULL);
        }

		if(my_linkoo && my_linkoo->IsOpen())
		{
			my_linkoo->CloseDevice();
		}

		cout << e.what() << endl;
		testOpenDevice8 = false;
	}
}*/
///////////////////////////////////////////////////////////
////////////////// TEST OPEN DEVICE ///////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////// TEST SET GET DEVICE INFO /////////////////
///////////////////////////////////////////////////////////

void testSetGetDeviceInfo()
{
	if(my_linkoo != NULL)
	{
		testSetGetDeviceInfo0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetDeviceInfo0 = false;
	}

	//Set up
	BtalkDeviceInfo myDeviceInfo;

	myDeviceInfo.DeviceType = 'a';
	myDeviceInfo.DeviceVersion = 'b';

	for(unsigned char i=1; i<=16; i++)
	{
		myDeviceInfo.UserDefinedName[i-1] = (unsigned char)((int)i+96);
	}

	myDeviceInfo.DeviceIpAddress = 0x1111aaaa;
	myDeviceInfo.DeviceSubnetMask = 0x2222bbbb;
	myDeviceInfo.DeviceGateway = 0x3333cccc;
	myDeviceInfo.DevicePrimaryDNS = 0x4444dddd;
	myDeviceInfo.DeviceSecondaryDNS = 0x5555eeee;
	myDeviceInfo.MacAddressHigh = 0x1234;
	myDeviceInfo.MacAddressLow = 0x6666ffff;

	BtalkDeviceInfo* myReceivedDeviceInfo;
	bool getSetSuccessful = true;

	//process
	try
    {
		my_linkoo->OpenDevice();
		my_linkoo->GetNetworkInfo()->SetDeviceInfo(&myDeviceInfo);
		myReceivedDeviceInfo = my_linkoo->GetNetworkInfo()->GetDeviceInfo();
      
         // memcmp is a BAD idea to compare two structs
         // here is why: http://learningcppisfun.blogspot.com/2008/05/comparing-structs-with-memcmp.html
         // CPPUNIT_ASSERT(memcmp(myReceivedDeviceInfo,&myDeviceInfo,sizeof(BtalkDeviceInfo))!=0);
         // the only valid way is member by member comparison =(

		// if one of the tests gives returns false, then no other tests are performed
		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->DeviceType == myReceivedDeviceInfo->DeviceType);
		}

		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->DeviceVersion == myReceivedDeviceInfo->DeviceVersion);
		}

	    if (getSetSuccessful==true)
        {
			for(int i=1; i<=16 && getSetSuccessful; i++)
            getSetSuccessful = getSetSuccessful && (myReceivedDeviceInfo->UserDefinedName[i] == myReceivedDeviceInfo->UserDefinedName[i]);
        }

		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->DeviceIpAddress == myReceivedDeviceInfo->DeviceIpAddress);
		}

		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->DeviceSubnetMask == myReceivedDeviceInfo->DeviceSubnetMask);
		}

		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->DeviceGateway == myReceivedDeviceInfo->DeviceGateway);
		}

		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->DevicePrimaryDNS == myReceivedDeviceInfo->DevicePrimaryDNS);
		}

		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->DeviceSecondaryDNS == myReceivedDeviceInfo->DeviceSecondaryDNS);
		}

		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->MacAddressHigh == myReceivedDeviceInfo->MacAddressHigh);
		}
		if (getSetSuccessful==true)
		{
			getSetSuccessful = (myReceivedDeviceInfo->MacAddressLow == myReceivedDeviceInfo->MacAddressLow);
		}

		my_linkoo->CloseDevice();
      
		if (getSetSuccessful == true)
		{
			testSetGetDeviceInfo1 = true;
		}

		else
		{
			testSetGetDeviceInfo1 = false;
		}

	}
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetDeviceInfo2 = false;
    }
}

///////////////////////////////////////////////////////////
//////////////// TEST SET GET DEVICE INFO /////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SET GET IP ADDRESS /////////////////
///////////////////////////////////////////////////////////

void testSetGetIpAddress()
{

	if(my_linkoo != NULL)
	{
		testSetGetIpAddress0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetIpAddress0 = false;
	}

	//process
	try
	{      
		my_linkoo->OpenDevice();
		long OriginalIp = my_linkoo->GetNetworkInfo()->GetIpAddress();
		long IpToSet = (OriginalIp & 0x00FFFFFF) + ((OriginalIp & 0xFF000000)+0x01000000);
		my_linkoo->GetNetworkInfo()->SetIpAddress(IpToSet);

		if(my_linkoo->GetNetworkInfo()->GetIpAddress() != OriginalIp)
		{
			testSetGetIpAddress1 = true;
		}
		else
		{
			testSetGetIpAddress1 = false;
		}
		
		if(my_linkoo->GetNetworkInfo()->GetIpAddress() == IpToSet)
		{
			testSetGetIpAddress2 = true;
		}
		else
		{
			testSetGetIpAddress2 = false;
		}

		my_linkoo->GetNetworkInfo()->SetIpAddress(OriginalIp);
	}
   
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetIpAddress3 = false;
    }

	if(my_linkoo->IsOpen())
	{
		my_linkoo->CloseDevice();
	}
}

///////////////////////////////////////////////////////////
///////////////// TEST SET GET IP ADDRESS /////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
////////////////// TEST SET GET GATEWAY ///////////////////
///////////////////////////////////////////////////////////

void testSetGetGateway()
{
	if(my_linkoo != NULL)
	{
		testSetGetGateway0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetGateway0 = false;
	}
	
	//process
	try
	{
		my_linkoo->OpenDevice();
		long OriginalIp = my_linkoo->GetNetworkInfo()->GetGateway();
		long GatewayToSet = 0;
		my_linkoo->GetNetworkInfo()->SetGateway(GatewayToSet);
		
		if(my_linkoo->GetNetworkInfo()->GetGateway() == GatewayToSet)
		{
			testSetGetGateway1 = true;
		}
		else
		{
			testSetGetGateway1 = false;
		}

		my_linkoo->GetNetworkInfo()->SetGateway(OriginalIp);
	}

	catch(CBgaException &e)
	{
		cout << e.what() << endl;
		testSetGetGateway2 = false;
    }

	if(my_linkoo->IsOpen())
	{
		my_linkoo->CloseDevice();
	}
}

///////////////////////////////////////////////////////////
////////////////// TEST SET GET GATEWAY ///////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SET GET SUBNETMASK /////////////////
///////////////////////////////////////////////////////////

void testSetGetSubnetMask()
{
	if(my_linkoo != NULL)
	{
		testSetGetSubnetMask0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetSubnetMask0 = false;
	}

	//process
	try
	{
		my_linkoo->OpenDevice();
		my_linkoo->GetNetworkInfo()->SetSubnetMask(0x0000FFFF);
		
		if(my_linkoo->GetNetworkInfo()->GetSubnetMask() == 0x0000FFFF)
		{
			testSetGetSubnetMask1 = true;
		}
		else
		{
			testSetGetSubnetMask1 = false;
		}
    }
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetSubnetMask2 = false;
    }

	if(my_linkoo->IsOpen())
	{
      my_linkoo->CloseDevice();
	}
}

///////////////////////////////////////////////////////////
///////////////// TEST SET GET SUBNETMASK /////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////// TEST SET GET PRIMARY DNS /////////////////
///////////////////////////////////////////////////////////

void testSetGetPrimaryDns()
{
	if(my_linkoo != NULL)
	{
		testSetGetPrimaryDns0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetPrimaryDns0 = false;
	}

	//process
	try
	{
		my_linkoo->OpenDevice();
		long OriginalDns = my_linkoo->GetNetworkInfo()->GetPrimaryDns();
		my_linkoo->GetNetworkInfo()->SetPrimaryDns(0x4444ddd0);

		if(my_linkoo->GetNetworkInfo()->GetPrimaryDns() == 0x4444ddd0)
		{
			testSetGetPrimaryDns1 = true;
		}
		else
		{
			testSetGetPrimaryDns1 = false;
		}

		my_linkoo->GetNetworkInfo()->SetPrimaryDns(OriginalDns);
	}
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetPrimaryDns2 = false;
    }

	if(my_linkoo->IsOpen())
	{
		my_linkoo->CloseDevice();
	}
}

///////////////////////////////////////////////////////////
//////////////// TEST SET GET PRIMARY DNS /////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
/////////////// TEST SET GET SECONDARY DNS ////////////////
///////////////////////////////////////////////////////////

void testSetGetSecondaryDns()
{
	if(my_linkoo != NULL)
	{
		testSetGetSecondaryDns0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetSecondaryDns0 = false;
	}

	//process
	try
    {
		my_linkoo->OpenDevice();
		long OriginalDns = my_linkoo->GetNetworkInfo()->GetSecondaryDns();
		my_linkoo->GetNetworkInfo()->SetSecondaryDns(0x5555eee0);

		if(my_linkoo->GetNetworkInfo()->GetSecondaryDns() == 0x5555eee0)
		{
			testSetGetSecondaryDns1 = true;
		}
		else
		{
			testSetGetSecondaryDns1 = false;
		}

		my_linkoo->GetNetworkInfo()->SetSecondaryDns(OriginalDns);
    }
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetSecondaryDns2 = false;
    }

	if(my_linkoo->IsOpen())
	{
		my_linkoo->CloseDevice();
	}
}

///////////////////////////////////////////////////////////
/////////////// TEST SET GET SECONDARY DNS ////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////////// TEST SET GET NAME ////////////////////
///////////////////////////////////////////////////////////

void testSetGetName()
{
	if(my_linkoo != NULL)
	{
		testSetGetName0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetName0 = false;
	}

	//process
	try
    {
		my_linkoo->OpenDevice();
		unsigned char myUserDefinedName[16] = "myUDName";
		unsigned char returnedUserDefinedName[16] = "";
		my_linkoo->GetNetworkInfo()->SetName((const char*)myUserDefinedName, sizeof(myUserDefinedName));
		my_linkoo->GetNetworkInfo()->GetName( (char*)returnedUserDefinedName, 16);
		//Gets aplied instantly, no use of SaveConfiguration here.

		if(strcmp((const char*)myUserDefinedName, (const char*)returnedUserDefinedName) == 0)
		{
			testSetGetName1 = true;
		}
		else
		{
			testSetGetName1 = false;
		}
    }

	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetName2 = false;
    }

	if(my_linkoo->IsOpen())
	{
		my_linkoo->CloseDevice();
	}
}

///////////////////////////////////////////////////////////
//////////////////// TEST SET GET NAME ////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
/////////////// TEST GET HARDWARE REVISION ////////////////
///////////////////////////////////////////////////////////

void testGetHardwareRevision()
{
	if(my_linkoo != NULL)
	{
		testGetHardwareRevision0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testGetHardwareRevision0 = false;
	}

	//process
	try
    {
		my_linkoo->GetNetworkInfo()->GetHardwareVersion(); //what do I compare it with ??
    }
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testGetHardwareRevision1 = false;
    }
}

///////////////////////////////////////////////////////////
/////////////// TEST GET HARDWARE REVISION ////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
/////////////// TEST GET FIRMWARE REVISION ////////////////
///////////////////////////////////////////////////////////

void testGetFirmwareRevision()
{
	if(my_linkoo != NULL)
	{
		testGetFirmwareRevision0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testGetFirmwareRevision0 = false;
	}

	//process
	try
    {
		my_linkoo->GetNetworkInfo()->GetFirmwareVersion(); //what do I compare it with ??
    }
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testGetFirmwareRevision1 = false;
    }
}

///////////////////////////////////////////////////////////
/////////////// TEST GET FIRMWARE REVISION ////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////////// TEST GET TYPE ///////////////////////
///////////////////////////////////////////////////////////

void testGetType()
{
	if(my_linkoo != NULL)
	{
		testGetType0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testGetType0 = false;
	}

	//process
	try
    {
		if(my_linkoo->GetType() == eLinkoo || my_linkoo->GetType() == ePICDEM2 || my_linkoo->GetType() == eBouboule)
		{
			testGetType1 = true;
		}
		else
		{
			testGetType1 = false;
		}
    }
   
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testGetType2 = false;
    }
}

///////////////////////////////////////////////////////////
///////////////////// TEST GET TYPE ///////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
////////////////// TEST GET MAC ADDRESS ///////////////////
///////////////////////////////////////////////////////////

void testGetMacAddress()
{
	if(my_linkoo != NULL)
	{
		testGetMacAddress0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testGetMacAddress0 = false;
	}
	
	//process
	try
    {
		my_linkoo->GetNetworkInfo()->GetMacAddress();//what do I compare it with ??
    }
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testGetMacAddress1 = false;
    }
}

///////////////////////////////////////////////////////////
////////////////// TEST GET MAC ADDRESS ///////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SET GET BAUD RATE //////////////////
///////////////////////////////////////////////////////////

void testSetGetBaudRate()
{
	if(my_linkoo != NULL)
	{
		testSetGetBaudRate0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetBaudRate0 = false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumBaudRate CurrentBaudRate;

	//Process
	//Get/Set all the possible baud rates in the enumeration. Ensure that they are all settable and readable
	try
	{      
		CurrentBaudRate = my_linkoo->GetBaudRate();

		my_linkoo->SetBaudRate(e110);
		if(my_linkoo->GetBaudRate() == e110)
		{
			testSetGetBaudRate1 = true;
		}
		else
		{
			testSetGetBaudRate1 = false;
		}

		my_linkoo->SetBaudRate(e300);
		if(my_linkoo->GetBaudRate() == e300)
		{
			testSetGetBaudRate2 = true;
		}
		else
		{
			testSetGetBaudRate2 = false;
		}

		my_linkoo->SetBaudRate(e1200);
		if(my_linkoo->GetBaudRate() == e1200)
		{
			testSetGetBaudRate3 = true;
		}
		else
		{
			testSetGetBaudRate3 = false;
		}

		my_linkoo->SetBaudRate(e2400);
		if(my_linkoo->GetBaudRate() == e2400)
		{
			testSetGetBaudRate4 = true;
		}
		else
		{
			testSetGetBaudRate4 = false;
		}

		my_linkoo->SetBaudRate(e4800);
		if(my_linkoo->GetBaudRate() == e4800)
		{
			testSetGetBaudRate5 = true;
		}
		else
		{
			testSetGetBaudRate5 = false;
		}

		my_linkoo->SetBaudRate(e9600);
		if(my_linkoo->GetBaudRate() == e9600)
		{
			testSetGetBaudRate6 = true;
		}
		else
		{
			testSetGetBaudRate6 = false;
		}

		my_linkoo->SetBaudRate(e19200);
		if(my_linkoo->GetBaudRate() == e19200)
		{
			testSetGetBaudRate7 = true;
		}
		else
		{
			testSetGetBaudRate7 = false;
		}

		my_linkoo->SetBaudRate(e38400);
		if(my_linkoo->GetBaudRate() == e38400)
		{
			testSetGetBaudRate8 = true;
		}
		else
		{
			testSetGetBaudRate8 = false;
		}

		my_linkoo->SetBaudRate(e57600);
		if(my_linkoo->GetBaudRate() == e57600)
		{
			testSetGetBaudRate9 = true;
		}
		else
		{
			testSetGetBaudRate9 = false;
		}

		my_linkoo->SetBaudRate(e115200);
		if(my_linkoo->GetBaudRate() == e115200)
		{
			testSetGetBaudRate10 = true;
		}
		else
		{
			testSetGetBaudRate10 = false;
		}

		my_linkoo->SetBaudRate(CurrentBaudRate);
	}
   
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetBaudRate11 = false;
    }

	my_linkoo->CloseDevice();
}

///////////////////////////////////////////////////////////
///////////////// TEST SET GET BAUD RATE //////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
/////////////////// TEST SET GET PARITY ///////////////////
///////////////////////////////////////////////////////////

void testSetGetParity()
{   
	if(my_linkoo != NULL)
	{
		testSetGetParity0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetParity0 = false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumParity CurrentParity;

	//Process
	try
    {      
		CurrentParity = my_linkoo->GetParity();

		my_linkoo->SetParity(eNoParity);
		if((my_linkoo->GetParity() == eNoParity))
		{
			testSetGetParity1 = true;
		}
		else
		{
			testSetGetParity1 = false;
		}

		my_linkoo->SetParity(eEvenParity);
		if(my_linkoo->GetParity() == eEvenParity)
		{
			testSetGetParity2 = true;
		}
		else
		{
			testSetGetParity2 = false;
		}

		my_linkoo->SetParity(eOddParity);
		if(my_linkoo->GetParity() == eOddParity)
		{
			testSetGetParity3 = true;
		}
		else
		{
			testSetGetParity3 = false;
		}

		my_linkoo->SetParity(CurrentParity);
    }
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetParity4 = false;
    }

	my_linkoo->CloseDevice();
}

///////////////////////////////////////////////////////////
/////////////////// TEST SET GET PARITY ///////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SET GET DATE BITS //////////////////
///////////////////////////////////////////////////////////

void testSetGetDataBits()
{
	if(my_linkoo != NULL)
	{
		testSetGetDataBits0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetDataBits0 = false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumDataBits CurrentDataBits;

	//Process
	try
    {      
		CurrentDataBits = my_linkoo->GetDataBits();

		my_linkoo->SetDataBits(e7bits);
		if(my_linkoo->GetDataBits() == e7bits)
		{
			testSetGetDataBits1 = true;
		}
		else
		{
			testSetGetDataBits1 = false;
		}

		my_linkoo->SetDataBits(e8bits);
		if(my_linkoo->GetDataBits() == e8bits)
		{
			testSetGetDataBits2 = true;
		}
		else
		{
			testSetGetDataBits2 = false;
		}

		my_linkoo->SetDataBits(CurrentDataBits);
	}

	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetDataBits3 = false;
    }

   my_linkoo->CloseDevice();
}

///////////////////////////////////////////////////////////
///////////////// TEST SET GET DATE BITS //////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////// TEST SET GET FLOW CONTROL ////////////////
///////////////////////////////////////////////////////////

void testSetGetFlowControl()
{
	if(my_linkoo != NULL)
	{
		testSetGetFlowControl0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSetGetFlowControl0 = false;
	}
	
	//Set up
	my_linkoo->OpenDevice();
	enumFlowControl CurrentFlowControl;   

	//Process
	try
    {      
		CurrentFlowControl = my_linkoo->GetFlowControl();

		my_linkoo->SetFlowControl(eNoFlowControl);
		if(my_linkoo->GetFlowControl() == eNoFlowControl)
		{
			testSetGetFlowControl1 = true;
		}
		else
		{
			testSetGetFlowControl1 = false;
		}

		my_linkoo->SetFlowControl(eHardwareFlowControl);
		if(my_linkoo->GetFlowControl() == eHardwareFlowControl)
		{
			testSetGetFlowControl2 = true;
		}
		else
		{
			testSetGetFlowControl2 = false;
		}

		my_linkoo->SetFlowControl(eSoftwareFlowControl);
		if(my_linkoo->GetFlowControl() == eSoftwareFlowControl)
		{
			testSetGetFlowControl3 = true;
		}
		else
		{
			testSetGetFlowControl3 = false;
		}

		my_linkoo->SetFlowControl(CurrentFlowControl);
	}

	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSetGetFlowControl4 = false;
    }

	my_linkoo->CloseDevice();
}

///////////////////////////////////////////////////////////
//////////////// TEST SET GET FLOW CONTROL ////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////////// TEST UDP REG READ ////////////////////
///////////////////////////////////////////////////////////

void testUdpRegRead()
{
	if(my_linkoo != NULL)
	{
		testUdpRegRead0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testUdpRegRead0 = false;
	}
	
	enumFlowControl TcpFlowControl;
	enumDataBits    TcpDataBits;
	enumParity      TcpParity;
	enumBaudRate    TcpBaudRate;

	enumFlowControl UdpFlowControl;
	enumDataBits    UdpDataBits;
	enumParity      UdpParity;
	enumBaudRate    UdpBaudRate;

	try
    {
		my_linkoo->OpenDevice();

		TcpFlowControl = my_linkoo->GetFlowControl();
		TcpDataBits = my_linkoo->GetDataBits();
		TcpParity = my_linkoo->GetParity();
		TcpBaudRate = my_linkoo->GetBaudRate();

		//Logoff to force UDP register reads
		my_linkoo->CloseDevice();

		UdpFlowControl = my_linkoo->GetFlowControl();
		UdpDataBits = my_linkoo->GetDataBits();
		UdpParity = my_linkoo->GetParity();
		UdpBaudRate = my_linkoo->GetBaudRate();

		//Verify that we read the same values over UDP.
		if(UdpFlowControl == TcpFlowControl)
		{
			testUdpRegRead1 = true;
		}
		else
		{
			testUdpRegRead1 = false;
		}

		if(UdpDataBits == TcpDataBits)
		{
			testUdpRegRead2 = true;
		}
		else
		{
			testUdpRegRead2 = false;
		}

		if(UdpParity == TcpParity)
		{
			testUdpRegRead3 = true;
		}
		else
		{
			testUdpRegRead3 = false;
		}

		if(UdpBaudRate == TcpBaudRate)
		{
			testUdpRegRead4 = true;
		}
		else
		{
			testUdpRegRead4 = false;
		}

		my_linkoo->CloseDevice();
	}
	
	catch (CBgaException &e)
    {
		cout << e.what() << endl;
		testUdpRegRead5 = false;
    }
}

///////////////////////////////////////////////////////////
//////////////////// TEST UDP REG READ ////////////////////
///////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////
////////////////// TEST READ WRITE DATA ///////////////////
///////////////////////////////////////////////////////////
/*
void testReadWriteData()
{

#if BCL_USE_WINDOWS
   
	if(my_linkoo != NULL)
	{
		testReadWriteData0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testReadWriteData0 = false;
	}

	//Set up
	my_linkoo->OpenDevice();
	CSerial     PhysSerial;
	const unsigned int lTestCount = 7;
	long DataToWrite = 0x69696969;
	long DataToRead  = 0x00000000;

	//We use these arrays to keep track of enum values that are passed during our test run.
	CSerial::EBaudrate lBaudRates[lTestCount] = {/*CSerial::EBaud110,
												 CSerial::EBaud300,*/
/*												CSerial::EBaud1200,
                                                CSerial::EBaud2400,
                                                CSerial::EBaud9600,
                                                CSerial::EBaud19200,
                                                CSerial::EBaud38400,
                                                CSerial::EBaud57600,
                                                CSerial::EBaud115200};
	enumBaudRate       rBaudRates[lTestCount] = {/*e110,
                                                e300,*/
  /*                                              e1200,
                                                e2400,
                                                e9600,
                                                e19200,
                                                e38400,
                                                e57600,
                                                e115200};
	try
    {        
		for(unsigned int i=0; i<lTestCount; i++)
        {
			PhysSerial.Open(_T("COM1"));
			PhysSerial.Setup(lBaudRates[i], CSerial::EData8, CSerial::EParNone, CSerial::EStop1);
			PhysSerial.SetupHandshaking(CSerial::EHandshakeOff);     

			//Send a byte pattern through the serial port and check that we receive
			//it on the Linkoo.
			DataToWrite = 0x69696900+i;
			DataToRead  = 0x00000000;

			my_linkoo->SetBaudRate(rBaudRates[i]);
			my_linkoo->SetDataBits(e8bits);
			my_linkoo->SetParity(eNoParity);
			my_linkoo->SetFlowControl(eNoFlowControl);

			//Test Linkoo Write
			//Always purge the  COM buffer to make sure we don't read in any old debugging data from the firmware.
			PhysSerial.Purge();

			//TBM: Note that we need to insert the sleeps because we are not interrupt-based.
			//     See ticket #41.
			my_linkoo->WriteData(&DataToWrite, sizeof(DataToWrite));
			Sleep(100);
			PhysSerial.Read(&DataToRead, sizeof(DataToRead));

			//Check
			printf("\nLinkoo wrote 0x%lX --- Windows COM read 0x%lX @ %ld bps\n", DataToWrite, DataToRead, rBaudRates[i]);
			if(DataToRead == DataToWrite)
			{
				testReadWriteData1 = true;
			}
			else
			{
				testReadWriteData1 = false;
			}

			//Test Linkoo READ
			DataToWrite = 0x12345600+i;
			DataToRead  = 0xFFFFFFFF;

			//Always purge the  COM buffer to make sure we don't read in any old debugging data from the firmware.
			PhysSerial.Purge();

			//TBM: Note that we need to insert the sleeps because we are not interrupt-based.
			//     See ticket #41.
			PhysSerial.Write(&DataToWrite, sizeof(DataToWrite));
			Sleep(100);
			my_linkoo->ReadData(&DataToRead, sizeof(DataToRead));

			//Check
			printf("\nWindows COM wrote 0x%lX --- Linkoo read 0x%lX @ %ld bps\n", DataToWrite, DataToRead, rBaudRates[i]);
		//	CPPUNIT_ASSERT(DataToRead == DataToWrite);
			if(DataToRead == DataToWrite)
			{
				testReadWriteData2 = true;
			}
			else
			{
				testReadWriteData2 = true;
			}

			PhysSerial.Close();
		}
	}
	
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testReadWriteData3 = false;
    }

	if(PhysSerial.IsOpen())
	{
      PhysSerial.Close();
	}

	my_linkoo->CloseDevice();

#else

   cout << "SQA not yet supported on UNIX platforms" << endl;

#endif

}

*/
///////////////////////////////////////////////////////////
////////////////// TEST READ WRITE DATA ///////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
///////////////// TEST SAVE CONFIGURATION /////////////////
///////////////////////////////////////////////////////////

void testSaveConfiguration()
{
	if(my_linkoo != NULL)
	{
		testSaveConfiguration0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testSaveConfiguration0 = false;
	}
	
	//process
	try
    {      
		long OriginalDns = my_linkoo->GetNetworkInfo()->GetPrimaryDns();      
		my_linkoo->OpenDevice();
		my_linkoo->GetNetworkInfo()->SaveConfiguration();
		my_linkoo->GetNetworkInfo()->SetPrimaryDns(0xFEABFEAB);
		my_linkoo->GetNetworkInfo()->SaveConfiguration(); 
		my_linkoo->GetNetworkInfo()->SetPrimaryDns(0x00000000);
		my_linkoo->GetNetworkInfo()->LoadConfiguration();

		if(my_linkoo->GetNetworkInfo()->GetPrimaryDns() == 0xFEABFEAB)
		{
			testSaveConfiguration1 = true;
		}
		else
		{
			testSaveConfiguration1 = false;
		}

		my_linkoo->GetNetworkInfo()->SetPrimaryDns(OriginalDns);

		if(my_linkoo->IsOpen())
		{
			my_linkoo->CloseDevice();
		}
	}

	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testSaveConfiguration2 = false;
    }
}

///////////////////////////////////////////////////////////
///////////////// TEST SAVE CONFIGURATION /////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
//////////////////// TEST IS AVAILABLE ////////////////////
///////////////////////////////////////////////////////////

void testIsAvailable()
{
	if(my_linkoo != NULL)
	{
		testIsAvailable0 = true;
	}
	else
	{
		cout << "Connect a device!" << endl;
		testIsAvailable0 = false;
	}

	try
    {
		if((my_linkoo->IsAvailable()))
		{
			testIsAvailable1 = true;
		}
		else
		{
			testIsAvailable1 = false;
		}
    }
   
	catch(CBgaException &e)
    {
		cout << e.what() << endl;
		testIsAvailable2 = false;
    }
}

///////////////////////////////////////////////////////////
//////////////////// TEST IS AVAILABLE ////////////////////
///////////////////////////////////////////////////////////




///////////////////////////////////////////////////////////
/////////////////////// MAIN FUNCTION /////////////////////
///////////////////////////////////////////////////////////

int main(int argc, char* argv[]) 
{	
	ofstream File,file;

	char dateStr [9];
    char timeStr [9];
	int n = 1;

	if (argc < 2)
	{
      printf("Dude are you passing something at all");
        return 0;
	}
	
	if(strcmp(argv[1],"test") == 0)
	{	
		File.open("TestCases.ini",ofstream::app);
		File<<"\n[TESTCASES]\n";
		//printf("TESTFILENAME: test1.exe" "\n");
		//File<<"filename="<<argv[0]<<endl;
		_strdate(dateStr);
		//printf("DATE: %s \n", dateStr);
		_strtime( timeStr );
		File<<"dt= "<<dateStr<<" "<<timeStr<<endl;
		//printf("TIME %s \n", timeStr);
		File<<"tc=20"<<endl; //number of test cases in exe file

		for(int i=2; i<argc; i++)
		{	
			//first argument

			///////////////////////////////////
			//testing testOpenDevice() function
			///////////////////////////////////
	/*		if(strcmp(argv[i],"testOpenDevice") == 0)
			{	
				File<<"[Test " << n << "]" << endl;
				File<<"t1descr=testOpenDevice" << endl;
				File<<"t1dn=9"<< endl; //number of "if" statements in test

				setUp();
				testOpenDevice();

				if(testOpenDevice0 == true)
				{
					File<<"t1d1descr=my_linkoo != NULL" << endl;
					File<<"t1d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;

				}
				
				else
				{
					File<<"t1d1descr=my_linkoo != NULL" << endl;
					File<<"t1d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;

				}
					
				if(testOpenDevice1 == true)
				{
					File<<"t1d2descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == false" << endl;
					File<<"t1d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;

				}

				else
				{
					File<<"t1d2descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == false" << endl;
					File<<"t1d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;

				}

				if(testOpenDevice2 == true)
				{
					File<<"t1d3descr=e.GetExceptionId() == EX_NO_CONNECT_ID" << endl;
					File<<"t1d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;

				}

				else
				{
					File<<"t1d3descr=e.GetExceptionId() == EX_NO_CONNECT_ID" << endl;
					File<<"t1d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;

				}

				if(testOpenDevice3 == true)
				{
					File<<"t1d4descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == true" << endl;
					File<<"t1d4=Successful" << endl;
					cout << "Test #4 = Successful! " << endl;

				}

				else
				{
					File<<"t1d4descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == true" << endl;
					File<<"t1d4=Failed" << endl;
					cout << "Test #4 = Failed! " << endl;

				}

				if(testOpenDevice4 == true)
				{
					File<<"t1d5descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == true" << endl;
					File<<"t1d5=Successful" << endl;
					cout << "Test #5 = Successful! " << endl;

				}

				else
				{
					File<<"t1d5descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == true" << endl;
					File<<"t1d5=Failed" << endl;
					cout << "Test #5 = Failed! " << endl;

				}

				if(testOpenDevice5 == true)
				{
					File<<"t1d6descr=e.GetExceptionId() == EX_BAD_PASSWORD_ID" << endl;
					File<<"t1d6=Successful" << endl;
					cout << "Test #6 = Successful! " << endl;

				}

				else
				{
					File<<"t1d6descr=e.GetExceptionId() == EX_BAD_PASSWORD_ID" << endl;
					File<<"t1d6=Failed" << endl;
					cout << "Test #6 = Failed! " << endl;

				}

				if(testOpenDevice6 == true)
				{
					File<<"t1d7descr=e.GetExceptionId() == EX_NO_CONNECT_ID" << endl;
					File<<"t1d7=Successful" << endl;
					cout << "Test #7 = Successful! " << endl;

				}

				else
				{
					File<<"t1d7descr=e.GetExceptionId() == EX_NO_CONNECT_ID" << endl;
					File<<"t1d7=Failed" << endl;
					cout << "Test #7 = Failed! " << endl;

				}

				if(testOpenDevice7 == true)
				{
					File<<"t1d8descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == false" << endl;
					File<<"t1d8=Successful" << endl;
					cout << "Test #8 = Successful! " << endl;

				}

				else
				{
					File<<"t1d8descr=my_linkoo->GetNetworkInfo()->IsPasswordProtected() == false" << endl;
					File<<"t1d8=Failed" << endl;
					cout << "Test #8 = Failed! " << endl;

				}

				if(testOpenDevice0 == false || testOpenDevice1 == false || testOpenDevice2 == false || testOpenDevice3 == false || testOpenDevice4 == false || testOpenDevice5 == false || testOpenDevice6 == false || testOpenDevice7 == false || testOpenDevice8 == false)
				{
					File<<"t1result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}
*/
			/////////////////////////////////////////
			//testing testSetGetDeviceInfo() function
			/////////////////////////////////////////
//			else if(strcmp(argv[i],"testSetGetDeviceInfo") == 0)
	 if(strcmp(argv[i],"testSetGetDeviceInfo") == 0)
			{				
				File<<"[Test " << n << "]" << endl;
				File<<"t2descr=testSetGetDeviceInfo" << endl;
				File<<"t2dn=3"<< endl; //number of "if" statements in test


				setUp();
				testSetGetDeviceInfo();

				if(testSetGetDeviceInfo0 == true)
				{
					File<<"t2d1=my_linkoo != NULL" << endl;
					File<<"t2d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;

				}
				
				else
				{
					File<<"t2d1=my_linkoo != NULL" << endl;
					File<<"t2d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetDeviceInfo1 = true)
				{					
					File<<"t2d2=getSetSuccessful == true" << endl;
					File<<"t2d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
			
				else
				{
					File<<"t2d2=getSetSuccessful == true" << endl;
					File<<"t2d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetDeviceInfo0 == false || testSetGetDeviceInfo1 == false || testSetGetDeviceInfo2 == false)
				{
					File<<"t2result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}
			
			////////////////////////////////////////
			//testing testSetGetIpAddress() function
			////////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetIpAddress") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t3descr=testSetGetIpAddress" << endl;
				File<<"t3dn=4"<< endl; //number of "if" statements in test

				setUp();
				testSetGetIpAddress();

				if(testSetGetIpAddress0 == true)
				{
					File<<"t3d1=my_linkoo != NULL" << endl;
					File<<"t3d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t3d1=my_linkoo != NULL" << endl;
					File<<"t3d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetIpAddress1 == true)
				{
					File<<"t3d2=my_linkoo->GetNetworkInfo()->GetIpAddress() != OriginalIp" << endl;
					File<<"t3d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
			
				else
				{
					File<<"t3d2=my_linkoo->GetNetworkInfo()->GetIpAddress() != OriginalIp" << endl;
					File<<"t3d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetIpAddress2 == true)
				{
					File<<"t3d3=my_linkoo->GetNetworkInfo()->GetIpAddress() == IpToSet" << endl;
					File<<"t3d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;
				}
			
				else
				{
					File<<"t3d3=my_linkoo->GetNetworkInfo()->GetIpAddress() == IpToSet" << endl;
					File<<"t3d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;
				}

				if(testSetGetIpAddress0 == false || testSetGetIpAddress1 == false || testSetGetIpAddress2 == false || testSetGetIpAddress3 == false)
				{
					File<<"t3result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;

				}

				tearDown();
				n++;
			}

			//////////////////////////////
			//testSetGetGateway() function
			//////////////////////////////
			else if(strcmp(argv[i],"testSetGetGateway") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t4descr=testSetGetDeviceInfo" << endl;
				File<<"t4dn=3"<< endl; //number of "if" statements in test

				setUp();
				testSetGetGateway();
				
				if(testSetGetGateway0 == true)
				{
					File<<"t4d1=my_linkoo != NULL" << endl;
					File<<"t4d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t4d1=my_linkoo != NULL" << endl;
					File<<"t4d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetGateway1 == true)
				{
					File<<"t4d2=my_linkoo->GetNetworkInfo()->GetGateway() == GatewayToSet" << endl;
					File<<"t4d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t4d2=my_linkoo->GetNetworkInfo()->GetGateway() == GatewayToSet" << endl;
					File<<"t4d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetGateway0 == false || testSetGetGateway1 == false || testSetGetGateway2 == false)
				{
					File<<"t4result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			/////////////////////////////////////////
			//testing testSetGetSubnetMask() function
			/////////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetSubnetMask") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t5descr=testSetGetSubnetMask" << endl;
				File<<"t5dn=3"<< endl; //number of "if" statements in test

				setUp();
				testSetGetSubnetMask();

				if(testSetGetSubnetMask0 == true)
				{
					File<<"t5d1=my_linkoo != NULL" << endl;
					File<<"t5d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t5d1=my_linkoo != NULL" << endl;
					File<<"t5d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetSubnetMask1 == true)
				{
					File<<"t5d2=my_linkoo->GetNetworkInfo()->GetSubnetMask() == 0x0000FFFF" << endl;
					File<<"t5d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t5d2=my_linkoo->GetNetworkInfo()->GetSubnetMask() == 0x0000FFFF" << endl;
					File<<"t5d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetSubnetMask0 == false || testSetGetSubnetMask1 == false || testSetGetSubnetMask2 == false)
				{
					File<<"t5result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			/////////////////////////////////
			//testSetGetPrimaryDns() function
			/////////////////////////////////
			else if(strcmp(argv[i],"testSetGetPrimaryDns") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t6descr=testSetGetPrimaryDns" << endl;
				File<<"t1dn=3"<< endl; //number of "if" statements in test

				setUp();
				testSetGetPrimaryDns();

				if(testSetGetPrimaryDns0 == true)
				{
					File<<"t6d1=my_linkoo != NULL" << endl;
					File<<"t6d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t6d1=my_linkoo != NULL" << endl;
					File<<"t6d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;

				}

				if(testSetGetPrimaryDns1 == true)
				{
					File<<"t6d2=my_linkoo->GetNetworkInfo()->GetPrimaryDns() == 0x4444ddd0" << endl;
					File<<"t6d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;

				}
				else
				{
					File<<"t6d2=my_linkoo->GetNetworkInfo()->GetPrimaryDns() == 0x4444ddd0" << endl;
					File<<"t6d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetPrimaryDns0 == false || testSetGetPrimaryDns1 == false || testSetGetPrimaryDns2 == false)
				{
					File<<"t6result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			///////////////////////////////////////////
			//testing testSetGetSecondaryDns() function
			///////////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetSecondaryDns") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t7descr=testSetGetSecondaryDns" << endl;

				setUp();
				testSetGetSecondaryDns();

				if(testSetGetSecondaryDns0 == true)
				{
					File<<"t7d1=my_linkoo != NULL" << endl;
					File<<"t7d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t7d1=my_linkoo != NULL" << endl;
					File<<"t7d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetSecondaryDns1 == true)
				{
					File<<"t7d2=my_linkoo->GetNetworkInfo()->GetSecondaryDns() == 0x5555eee0" << endl;
					File<<"t7d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t7d2=my_linkoo->GetNetworkInfo()->GetSecondaryDns() == 0x5555eee0" << endl;
					File<<"t7d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetSecondaryDns0 == false || testSetGetSecondaryDns1 == false || testSetGetSecondaryDns2 == false)
				{
					File<<"t7result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;

				}

				tearDown();
				n++;
			}

			///////////////////////////////////
			//testing testSetGetName() function
			///////////////////////////////////
			else if(strcmp(argv[i],"testSetGetName") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t8descr=testSetGetName" << endl;
				File<<"t8dn=3"<< endl; //number of "if" statements in test

				setUp();
				testSetGetName();

				if(testSetGetName0 == true)
				{
					File<<"t8d1=my_linkoo != NULL" << endl;
					File<<"t8d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t8d1=my_linkoo != NULL" << endl;
					File<<"t8d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetName1 == true)
				{
					File<<"t8d2=strcmp((const char*)myUserDefinedName, (const char*)returnedUserDefinedName) == 0" << endl;
					File<<"t8d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t8d2=strcmp((const char*)myUserDefinedName, (const char*)returnedUserDefinedName) == 0" << endl;
					File<<"t8d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;

				}

				if(testSetGetName0 == false || testSetGetName1 == false || testSetGetName2 == false)
				{
					File<<"t8result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			////////////////////////////////////////////
			//testing testGetHardwareRevision() function
			////////////////////////////////////////////
			else if(strcmp(argv[i],"testGetHardwareRevision") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t9descr=testGetHardwareRevision" << endl;
				File<<"t9dn=2"<< endl; //number of "if" statements in test

				setUp();
				testGetHardwareRevision();

				if(testGetHardwareRevision0 == true)
				{
					File<<"t9d1=my_linkoo != NULL" << endl;
					File<<"t9d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t9d1=my_linkoo != NULL" << endl;
					File<<"t9d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testGetHardwareRevision0 == false || testGetHardwareRevision1 == false)
				{
					File<<"t9result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			////////////////////////////////////////////
			//testing testGetFirmwareRevision() function
			////////////////////////////////////////////
			else if(strcmp(argv[i],"testGetFirmwareRevision") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t10descr=testGetFirmwareRevision" << endl;
				File<<"t10dn=2"<< endl; //number of "if" statements in test

				setUp();
				testGetFirmwareRevision();

				if(testGetFirmwareRevision0 == true)
				{
					File<<"t10d1=my_linkoo != NULL" << endl;
					File<<"t10d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t10d1=my_linkoo != NULL" << endl;
					File<<"t10d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testGetFirmwareRevision0 == false || testGetFirmwareRevision1 == false)
				{
					File<<"t10result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			////////////////////////////////
			//testing testGetType() function
			////////////////////////////////
			else if(strcmp(argv[i],"testGetType") == 0)
			{	
				File<<"[Test " << n << "]" << endl;
				File<<"t11descr=testGetType" << endl;
				File<<"t11dn=3"<< endl; //number of "if" statements in test

				setUp();
				testGetType();

				if(testGetType0 == true)
				{
					File<<"t10d1=my_linkoo != NULL" << endl;
					File<<"t10d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t10d1=my_linkoo != NULL" << endl;
					File<<"t11d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testGetType1 == true)
				{
					File<<"t11d2=my_linkoo->GetType() == eLinkoo || my_linkoo->GetType() == ePICDEM2 || my_linkoo->GetType() == eBouboule" << endl;
					File<<"t11d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t11d2=my_linkoo->GetType() == eLinkoo || my_linkoo->GetType() == ePICDEM2 || my_linkoo->GetType() == eBouboule" << endl;
					File<<"t11d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testGetType0 == false || testGetType1 == false || testGetType2 == false)
				{
					File<<"t11result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			////////////////////////////////////////////
			//testing testGetMacAddress() function
			////////////////////////////////////////////
			else if(strcmp(argv[i],"testGetMacAddress") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t12descr=testGetMacAddress" << endl;
				File<<"t12dn=2"<< endl; //number of "if" statements in test

				setUp();
				testGetMacAddress();

				if(testGetMacAddress0 == true)
				{
					File<<"t12d1=my_linkoo != NULL" << endl;
					File<<"t12d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t12d1=my_linkoo != NULL" << endl;
					File<<"t12d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testGetMacAddress0 == false || testGetMacAddress1 == false)
				{
					File<<"t12result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			///////////////////////////////////////
			//testing testSetGetBaudRate() function
			///////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetBaudRate") == 0)
			{	
				File<<"[Test " << n << "]" << endl;
				File<<"t13descr=testSetGetBaudRate" << endl;
				File<<"t13dn=12"<< endl; //number of "if" statements in test

				setUp();
				testSetGetBaudRate();

				if(testSetGetBaudRate0 == true)
				{
					File<<"t13d1=my_linkoo != NULL" << endl;
					File<<"t13d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t13d1=my_linkoo != NULL" << endl;
					File<<"t13d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetBaudRate1 == true)
				{
					File<<"t13d2=my_linkoo->GetBaudRate() == e110" << endl;
					File<<"t13d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t13d2=my_linkoo->GetBaudRate() == e110" << endl;
					File<<"t13d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetBaudRate2 == true)
				{
					File<<"t13d3=my_linkoo->GetBaudRate() == e300" << endl;
					File<<"t13d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;
				}
				else
				{
					File<<"t13d3=my_linkoo->GetBaudRate() == e300" << endl;
					File<<"t13d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;
				}

				if(testSetGetBaudRate3 == true)
				{
					File<<"t13d4=my_linkoo->GetBaudRate() == e1200" << endl;
					File<<"t13d4=Successful" << endl;
					cout << "Test #4 = Successful! " << endl;
				}
				else
				{
					File<<"t13d4=my_linkoo->GetBaudRate() == e1200" << endl;
					File<<"t13d4=Failed" << endl;
					cout << "Test #4 = Failed! " << endl;
				}

				if(testSetGetBaudRate4 == true)
				{
					File<<"t13d5=my_linkoo->GetBaudRate() == e2400" << endl;
					File<<"t13d5=Successful" << endl;
					cout << "Test #5 = Successful! " << endl;
				}
				else
				{
					File<<"t13d5=my_linkoo->GetBaudRate() == e2400" << endl;
					File<<"t13d5=Failed" << endl;
					cout << "Test #5 = Failed! " << endl;
				}

				if(testSetGetBaudRate5 == true)
				{
					File<<"t13d6=my_linkoo->GetBaudRate() == e4800" << endl;
					File<<"t13d6=Successful" << endl;
					cout << "Test #6 = Successful! " << endl;
				}
				else
				{
					File<<"t13d6=my_linkoo->GetBaudRate() == e4800" << endl;
					File<<"t13d6=Failed" << endl;
					cout << "Test #6 = Failed! " << endl;
				}

				if(testSetGetBaudRate6 == true)
				{
					File<<"t13d7=my_linkoo->GetBaudRate() == e9600" << endl;
					File<<"t13d7=Successful" << endl;
					cout << "Test #7 = Successful! " << endl;
				}
				else
				{
					File<<"t13d7=my_linkoo->GetBaudRate() == e9600" << endl;
					File<<"t13d7=Failed" << endl;
					cout << "Test #7 = Failed! " << endl;
				}

				if(testSetGetBaudRate7 == true)
				{
					File<<"t13d8=my_linkoo->GetBaudRate() == e19200" << endl;
					File<<"t13d8=Successful" << endl;
					cout << "Test #8 = Successful! " << endl;
				}
				else
				{
					File<<"t13d8=my_linkoo->GetBaudRate() == e19200" << endl;
					File<<"t13d8=Failed" << endl;
					cout << "Test #8 = Failed! " << endl;
				}

				if(testSetGetBaudRate8 == true)
				{
					File<<"t13d9=my_linkoo->GetBaudRate() == e38400" << endl;
					File<<"t13d9=Successful" << endl;
					cout << "Test #9 = Successful! " << endl;
				}
				else
				{
					File<<"t13d9=my_linkoo->GetBaudRate() == e38400" << endl;
					File<<"t13d9=Failed" << endl;
					cout << "Test #9 = Failed! " << endl;
				}

				if(testSetGetBaudRate9 == true)
				{
					File<<"t13d10=my_linkoo->GetBaudRate() == e57600" << endl;
					File<<"t13d10=Successful" << endl;
					cout << "Test #10 = Successful! " << endl;
				}
				else
				{
					File<<"t13d10=my_linkoo->GetBaudRate() == e57600" << endl;
					File<<"t13d10=Failed" << endl;
					cout << "Test #10 = Failed! " << endl;

				}

				if(testSetGetBaudRate10 == true)
				{
					File<<"t13d11=my_linkoo->GetBaudRate() == e115200" << endl;
					File<<"t13d11=Successful" << endl;
					cout << "Test #11 = Successful! " << endl;
				}
				else
				{
					File<<"t13d11=my_linkoo->GetBaudRate() == e115200" << endl;
					File<<"t13d11=Failed" << endl;
					cout << "Test #11 = Failed! " << endl;
				}

				if(testSetGetBaudRate0 == false || testSetGetBaudRate1 == false || testSetGetBaudRate2 == false || testSetGetBaudRate3 == false || testSetGetBaudRate4 == false || testSetGetBaudRate5 == false || testSetGetBaudRate6 == false || testSetGetBaudRate7 == false || testSetGetBaudRate8 == false || testSetGetBaudRate9 == false || testSetGetBaudRate10 == false || testSetGetBaudRate11 == false)
				{
					File<<"t13result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			/////////////////////////////////////
			//testing testSetGetParity() function
			/////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetParity") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t14descr=testSetGetParity" << endl;
				File<<"t14dn=5"<< endl; //number of "if" statements in test

				setUp();
				testSetGetParity();

				if(testSetGetParity0 == true)
				{
					File<<"t14d1=my_linkoo != NULL" << endl;
					File<<"t14d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t14d1=my_linkoo != NULL" << endl;
					File<<"t14d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetParity1 == true)
				{
					File<<"t14d2=my_linkoo->GetParity() == eNoParity" << endl;
					File<<"t14d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
			
				else
				{
					File<<"t14d2=my_linkoo->GetParity() == eNoParity" << endl;
					File<<"t14d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetParity2 == true)
				{
					File<<"t14d3=my_linkoo->GetParity() == eEvenParity" << endl;
					File<<"t14d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;
				}
			
				else
				{
					File<<"t14d3=my_linkoo->GetParity() == eEvenParity" << endl;
					File<<"t14d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;
				}

				if(testSetGetParity3 == true)
				{
					File<<"t14d4=my_linkoo->GetParity() == eOddParity" << endl;
					File<<"t14d4=Successful" << endl;
					cout << "Test #4 = Successful! " << endl;
				}
			
				else
				{
					File<<"t14d4=my_linkoo->GetParity() == eOddParity" << endl;
					File<<"t14d4=Failed" << endl;
					cout << "Test #4 = Failed! " << endl;
				}

				if(testSetGetParity0 == false || testSetGetParity1 == false || testSetGetParity2 == false || testSetGetParity3 == false || testSetGetParity4 == false)
				{
					File<<"t14result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			///////////////////////////////////////
			//testing testSetGetDataBits() function
			///////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetDataBits") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t15descr=testSetGetDataBits" << endl;
				File<<"t15dn=4"<< endl; //number of "if" statements in test

				setUp();
				testSetGetDataBits();

				if(testSetGetDataBits0 == true)
				{
					File<<"t15d1=my_linkoo != NULL" << endl;
					File<<"t15d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t15d1=my_linkoo != NULL" << endl;
					File<<"t15d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetDataBits1 == true)
				{
					File<<"t15d2=my_linkoo->GetDataBits() == e7bits" << endl;
					File<<"t15d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
			
				else
				{
					File<<"t15d2=my_linkoo->GetDataBits() == e7bits" << endl;
					File<<"t15d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetDataBits2 == true)
				{
					File<<"t15d3=my_linkoo->GetDataBits() == e8bits" << endl;
					File<<"t15d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;
				}
			
				else
				{
					File<<"t15d3=my_linkoo->GetDataBits() == e8bits" << endl;
					File<<"t15d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;
				}

				if(testSetGetDataBits0 == false || testSetGetDataBits1 == false || testSetGetDataBits2 == false || testSetGetDataBits3 == false)
				{
					File<<"t15result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			//////////////////////////////////////////
			//testing testSetGetFlowControl() function
			//////////////////////////////////////////
			else if(strcmp(argv[i],"testSetGetFlowControl") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t16descr=testSetGetFlowControl" << endl;
				File<<"t16dn=5"<< endl; //number of "if" statements in test

				setUp();
				testSetGetFlowControl();

				if(testSetGetFlowControl0 == true)
				{
					File<<"t16d1=my_linkoo != NULL" << endl;
					File<<"t16d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t16d1=my_linkoo != NULL" << endl;
					File<<"t16d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testSetGetFlowControl1 == true)
				{
					File<<"t16d2=my_linkoo->GetFlowControl() == eNoFlowControl" << endl;
					File<<"t16d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;

				}
			
				else
				{
					File<<"t16d2=my_linkoo->GetFlowControl() == eNoFlowControl" << endl;
					File<<"t16d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSetGetFlowControl2 == true)
				{
					File<<"t16d3=my_linkoo->GetFlowControl() == eHardwareFlowControl" << endl;
					File<<"t16d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;

				}
			
				else
				{
					File<<"t16d3=my_linkoo->GetFlowControl() == eHardwareFlowControl" << endl;
					File<<"t16d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;
				}

				if(testSetGetFlowControl3 == true)
				{
					File<<"t16d4=my_linkoo->GetFlowControl() == eSoftwareFlowControl" << endl;
					File<<"t16d4=Successful" << endl;
					cout << "Test #4 = Successful! " << endl;

				}
			
				else
				{
					File<<"t16d4=my_linkoo->GetFlowControl() == eSoftwareFlowControl" << endl;
					File<<"t16d4=Failed" << endl;
					cout << "Test #4 = Failed! " << endl;
				}

				if(testSetGetFlowControl0 == false || testSetGetFlowControl1 == false || testSetGetFlowControl2 == false || testSetGetFlowControl3 == false || testSetGetFlowControl4 == false)
				{
					File<<"t16result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;

				}

				tearDown();
				n++;
			}

			///////////////////////////////////
			//testing testUdpRegRead() function
			///////////////////////////////////
			else if(strcmp(argv[i],"testUdpRegRead") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t17descr=testUdpRegRead" << endl;
				File<<"t17dn=6"<< endl; //number of "if" statements in test

				setUp();
				testUdpRegRead();

				if(testUdpRegRead0 == true)
				{
					File<<"t17d1=my_linkoo != NULL" << endl;
					File<<"t17d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t17d1=my_linkoo != NULL" << endl;
					File<<"t17d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testUdpRegRead1 == true)
				{
					File<<"t17d2=UdpFlowControl == TcpFlowControl" << endl;
					File<<"t17d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
			
				else
				{
					File<<"t17d2=UdpFlowControl == TcpFlowControl" << endl;
					File<<"t17d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testUdpRegRead2 == true)
				{
					File<<"t17d3=UdpDataBits == TcpDataBits" << endl;
					File<<"t17d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;
				}
			
				else
				{
					File<<"t17d3=UdpDataBits == TcpDataBits" << endl;
					File<<"t17d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;
				}

				if(testUdpRegRead3 == true)
				{
					File<<"t17d4=UdpParity == TcpParity" << endl;
					File<<"t17d4=Successful" << endl;
					cout << "Test #4 = Successful! " << endl;
				}
			
				else
				{
					File<<"t17d4=UdpParity == TcpParity" << endl;
					File<<"t17d4=Failed" << endl;
					cout << "Test #4 = Failed! " << endl;
				}

				if(testUdpRegRead4 == true)
				{
					File<<"t17d5=UdpBaudRate == TcpBaudRate" << endl;
					File<<"t17d5=Successful" << endl;
					cout << "Test #5 = Successful! " << endl;
				}
			
				else
				{
					File<<"t17d5=UdpBaudRate == TcpBaudRate" << endl;
					File<<"t17d5=Failed" << endl;
					cout << "Test #5 = Failed! " << endl;

				}

				if(testUdpRegRead0 == false || testUdpRegRead1 == false || testUdpRegRead2 == false || testUdpRegRead3 == false || testUdpRegRead4 == false || testUdpRegRead5 == false)
				{
					File<<"t17result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			//////////////////////////////////////
			//testing testReadWriteData() function
			//////////////////////////////////////
		/*	else if(strcmp(argv[i],"testReadWriteData") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t18descr=testReadWriteData" << endl;
				File<<"t18dn=4"<< endl; //number of "if" statements in test

				setUp();
				testReadWriteData();

				if(testReadWriteData0 == true)
				{
					File<<"t18d1=my_linkoo != NULL" << endl;
					File<<"t18d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t18d1=my_linkoo != NULL" << endl;
					File<<"t18d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}

				if(testReadWriteData1 == true)
				{
					File<<"t18d2=DataToRead == DataToWrite" << endl;
					File<<"t18d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
			
				else
				{
					File<<"t18d2=DataToRead == DataToWrite" << endl;
					File<<"t18d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testReadWriteData2 == true)
				{
					File<<"t18d3=DataToRead == DataToWrite" << endl;
					File<<"t18d3=Successful" << endl;
					cout << "Test #3 = Successful! " << endl;
				}
			
				else
				{
					File<<"t18d3=DataToRead == DataToWrite" << endl;
					File<<"t18d3=Failed" << endl;
					cout << "Test #3 = Failed! " << endl;
				}

				if(testReadWriteData0 == false || testReadWriteData1 == false || testReadWriteData2 == false || testReadWriteData3 == false)
				{
					File<<"t18result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

		*/	//////////////////////////////////////////
			//testing testSaveConfiguration() function
			//////////////////////////////////////////
			else if(strcmp(argv[i],"testSaveConfiguration") == 0)
			{
				File<<"[Test " << n << "]" << endl;
				File<<"t19descr=testSaveConfiguration" << endl;
				File<<"t19dn=3"<< endl; //number of "if" statements in test

				setUp();
				testSaveConfiguration();

				if(testSaveConfiguration0 == true)
				{
					File<<"t19d1=my_linkoo != NULL" << endl;
					File<<"t19d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t19d1=my_linkoo != NULL" << endl;
					File<<"t19d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}
				
				if(testSaveConfiguration1 == true)
				{
					File<<"t19d2=my_linkoo->GetNetworkInfo()->GetPrimaryDns() == 0xFEABFEAB" << endl;
					File<<"t19d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t19d2=my_linkoo->GetNetworkInfo()->GetPrimaryDns() == 0xFEABFEAB" << endl;
					File<<"t19d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testSaveConfiguration0 == false || testSaveConfiguration1 == false || testSaveConfiguration2 == false)
				{
					File<<"t19result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

			////////////////////////////////////
			//testing testIsAvailable() function
			////////////////////////////////////
			else if(strcmp(argv[i],"testIsAvailable") == 0)
			{
				File<<"[Test " << n << "]" << endl<<"t20descr=testIsAvailable" << endl;
				File<<"t20dn=3"<< endl; //number of "if" statements in test

				setUp();
				testIsAvailable();

				if(testIsAvailable0 == true)
				{
					File<<"t20d1=my_linkoo != NULL" << endl;
					File<<"t20d1=Successful" << endl;
					cout << "Test #1 = Successful! " << endl;
				}
				
				else
				{
					File<<"t20d1=my_linkoo != NULL" << endl;
					File<<"t20d1=Failed" << endl;
					cout << "Test #1 = Failed! " << endl;
				}
				
				if(testIsAvailable1 == true)
				{
					File<<"t20d2=my_linkoo->IsAvailable()" << endl;
					File<<"t20d2=Successful" << endl;
					cout << "Test #2 = Successful! " << endl;
				}
				else
				{
					File<<"t20d2=my_linkoo->IsAvailable()" << endl;
					File<<"t20d2=Failed" << endl;
					cout << "Test #2 = Failed! " << endl;
				}

				if(testIsAvailable0 == false || testIsAvailable1 == false || testIsAvailable2 == false)
				{
					File<<"t20result=Failed" << endl;
					cout << "Overall Test Case = Failed! "<< endl;
				}

				tearDown();
				n++;
			}

		}
		
		 File.close();
	}

	else if(strcmp(argv[1],"list") == 0)
	{	
		File.open("TestCases.ini");
			
		File<<"[list]\n";

		File<<"Test1=testOpenDevice" << endl;
		File<<"Test2=testSetGetDeviceInfo" << endl;
		File<<"Test3=testSetGetIpAddress" << endl;
		File<<"Test4=testSetGetGateway" << endl;
		File<<"Test5=testSetGetSubnetMask" << endl;
		File<<"Test6=testSetGetPrimaryDns" << endl;
		File<<"Test7=testSetGetSecondaryDns" << endl;
		File<<"Test8=testSetGetName" << endl;
		File<<"Test9=testGetHardwareRevision" << endl;
		File<<"Test10=testGetFirmwareRevision" << endl;
		File<<"Test11=testGetType" << endl;
		File<<"Test12=testGetMacAddress" << endl;
		File<<"Test13=testSetGetBaudRate" << endl;
		File<<"Test14=testSetGetParity" << endl;
		File<<"Test15=testSetGetDataBits" << endl;
		File<<"Test16=testSetGetFlowControl" << endl;
		File<<"Test17=testReadWriteData" << endl;
		File<<"Test18=testUdpRegRead" << endl;
		File<<"Test19=testSaveConfiguration" << endl;
		File<<"Test20=testIsAvailable" << endl;

		cout << "Here are a list of Tests available: \n1) testOpenDevice\n2) testSetGetDeviceInfo\n3) testSetGetIpAddress\n4) testSetGetGateway\n5) testSetGetSubnetMask\n6) testSetGetPrimaryDns\n7) testSetGetSecondaryDns\n8) testSetGetName" << endl;
		cout << "9) testGetHardwareRevision \n10) testGetFirmwareRevision\n11) testGetType\n12) testGetMacAddress\n13) testSetGetBaudRate\n14) testSetGetParity\n15) testSetGetDataBits\n16) testSetGetFlowControl" << endl;
		cout << "17) testReadWriteData\n18) testUdpRegRead\n19) testSaveConfiguration\n20) testIsAvailable" << endl;

		File.close();
	}

	return 0;
}


///////////////////////////////////////////////////////////
/////////////////////// MAIN FUNCTION /////////////////////
///////////////////////////////////////////////////////////